{layout name="layout/header" /}
<link href="root/css/plugins/footable/footable.core.css" rel="stylesheet">
<link href="root/css/plugins/iCheck/custom.css" rel="stylesheet">

<link href="root/css/plugins/switchery/switchery.css" rel="stylesheet">
<script src="root/js/plugins/switchery/switchery.js"></script>
<!--<link href="root/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">-->
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>用户列表</h5>
                </div>
                <div class="ibox-title">
                    <p>
                        <button type="button" class="btn btn-primary btn-outline refresh">刷新</button>
                    </p>
                    <form class="form-inline">
                        <div class="form-group">
                            <select class="form-control " id="role">
                                <option value="0">全部身份</option>
                                <option value="1">参展者</option>
                                <option value="2">参观者</option>
                                <option value="3">媒体</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <select class="form-control " id="verify_status">
                                <option value="9">全部审核状态</option>
                                <option value="0">待上传</option>
                                <option value="1">待审核</option>
                                <option value="2">审核失败</option>
                                <option value="3">审核成功</option>
                            </select>
                        </div>
                        <div class="form-group">
                           <input type="text" id="keyword" class="form-control" placeholder="关键词" value="{$keyword}">
                        </div>
                        <a class="btn btn-success search">查找</a>
                    </form>
                </div>
                <div class="ibox-content">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>用户名</th>
                                <th>Email</th>
                                <th>身份</th>
                                <th>审核状态</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                        {volist name="data" id="vo"}
                        <tr pid="{$vo.id}" >
                            <td>{$vo.id}</td>
                            <td>{$vo.name}</td>
                            <td>{$vo.email}</td>
                            <!--<td><img width="60" height="60" src=""/></td>-->
                            <td>
                            {switch name="$vo.role"}
                            {case value="1"}<span class="text-info">参展者</span>{/case}
                            {case value="2"}<span class="text-danger">参观者</span>{/case}
                            {case value="3"}<span class="text-success">媒体</span>{/case}
                                {default /}<span>尚未选择</span>
                            {/switch}
                            </td>
                            <td>
                                {switch name="$vo.verify_status"}
                                {case value="0"}<span class="">待上传</span>{/case}
                                {case value="1"}<span class="text-warning">待审核</span>{/case}
                                {case value="2"}<span class="text-danger">审核失败</span>{/case}
                                {case value="3"}<span class="text-success">审核成功</span>{/case}
                                {/switch}
                            </td>
                            <td>{$vo.created_at}</td>
                            <td>
                                {if condition="$vo.role>0"}
                                <a type="button" class="btn btn-success btn-sm " href="{:url('info',['id'=>$vo.id])}">详情</a>
                                {eq name="$vo.verify_status" value="1"}
                                <a type="button" class="btn btn-danger btn-sm " href="{:url('verify',['id'=>$vo.id])}">审核</a>
                                {/eq}
                                {/if}
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                        <tfoot>
                        <tr>
                            <td colspan="5">
                                {$page}
                            </td>
                        </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!--layer-->
<script src="root/js/plugins/layer/layer.min.js"></script>
<!-- iCheck -->
<script src="root/js/plugins/iCheck/icheck.min.js"></script>
<script>
    $(document).ready(function() {
        var verify_status = "{$verify_status}";
        if(verify_status != '') $('#verify_status').val(verify_status);
        var role = "{$role}";
        if(role)
            $('#role').val(role);
        checks();
        //单选，复选按钮
        function checks () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green'
            })
        }
        var elem = document.querySelectorAll('.js-switch');
        elem.forEach(function(i,index){
            var a= "a" +index;
            a = new Switchery(i, {
            color: '#1AB394'
            });
        });

        //搜索
        $('.search').click(function () {
            var keyword = $("#keyword").val().trim();
            verify_status =$('#verify_status').val();
            role =$('#role').val();
            var url = "{:url('index')}"+'/role/'+role+'/verify_status/'+verify_status+'/keyword/'+keyword;
            window.location.href = url;
        });

    });
</script>
